#include <iostream>
#include <algorithm>
using namespace std;
#define DEBUG
#define int long long
const int MOD=100000007;
int n, m; //C(n, m)

int qmi(int base, int index)
{
    int res=1;
    while(index)
    {
        if(index&1) res=res*base%MOD;
        base=base*base%MOD;
        index>>=1;
    }
    return res;
}

int C(int a, int b)
{
    if(a<b) return 0;
    int up=1, down=1;
    for(int i=a, j=1; j<=b; i--, j++)
    {
        up=up*i%MOD;
        down=down*j%MOD;
    }
    return up*qmi(down, MOD-2)%MOD;
}

int Lucas(int a, int b)
{
    if(a<MOD&&b<MOD) return C(a, b);
    return C(a%MOD, b%MOD)*Lucas(a/MOD, b/MOD)%MOD;
}

signed main()
{
    #ifdef DEBUG
        freopen("./in.txt", "r", stdin);
        freopen("./out.txt", "w", stdout);
    #endif
    scanf("%d%d", &n, &m);
    int ans=Lucas(n, m)%MOD;
    ans=(ans+MOD)%MOD;
    cout << ans << endl;
    return 0;
}